package com.shop.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.shop.pojo.UserInfo;

public class UserSecurityInterceptor extends AbstractInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1016254711003322396L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		UserInfo userInfo=(UserInfo)invocation.getInvocationContext().getSession().get(UserInfo.USER_INFO);
		if(userInfo==null){
			return "login";
		}
		return invocation.invoke();
	}

}
